﻿using System;
using System.Collections.Generic;
using System.Text;
using RoadTeam.Model;
using System.Data;
using RoadTeam.Enums;

namespace RoadTeam.Pub
{
  public  class RtParameter
    {
      public RtParameter(String ParaName)
      {
          RtPara = new GetRtParameter(ParaName);
      }
      private GetRtParameter RtPara
      {
          get;
          set;
      }

      public  String ParamValue
      {
          get
          {
              return RtPara.ParamValue;
          }
      }

    }


  public class GetRtParameter
  {
      public GetRtParameter(String ParaName)
      {
          TbPcParameter para = new Model.TbPcParameter();

          SqlWhere where = new SqlWhere()
          {
              Info = new TbPcParameter() { ParamName = ParaName },
              SelectColumn=@" Top 1 ParamName,ParamValue,ParamType,ParamDesc "
          };
          DataTable dt=TbPcParameter.Select(where,GlobalConfig.RtConnectionString);
          if (dt.Rows.Count==0)return ;

          ParamName=(dt.Rows[0]["ParamName"]!=null)?dt.Rows[0]["ParamName"].ToString():String.Empty;
          ParamValue=(dt.Rows[0]["ParamValue"]!=null)?dt.Rows[0]["ParamValue"].ToString():String.Empty;
          ParamType=(dt.Rows[0]["ParamType"]!=null)?dt.Rows[0]["ParamType"].ToString():String.Empty;
          ParamDesc =(dt.Rows[0]["ParamDesc"]!=null)?dt.Rows[0]["ParamDesc"].ToString():String.Empty;

      }

      private string _paraName;
      public String ParamName
      {
          get{ return  _paraName;}
           set {   _paraName=value;}
      }
        private string _paramValue;
      public String ParamValue
      {
          get{ return  _paramValue;}
           set {   _paramValue=value;}
      }
        private string _paramType;
      public String ParamType
      {
          get{ return  _paramType;}
           set {   _paramType=value;}
      }
        private string _paramDesc;
      public String ParamDesc
      {
          get{ return  _paramDesc;}
           set {   _paramDesc=value;}
      }
  }
}
